using System;
using FluentJqGrid.Core.Search;

namespace FluentJqGrid.Infrastructure.Search
{
    public class FilterToolbarOptions : IFilterToolbarOptions, IDisposable
    {
        private readonly FilterToolbarProperties _filterToolbarProperties;

        internal FilterToolbarOptions(FilterToolbarProperties filterToolbarProperties)
        {
            _filterToolbarProperties = filterToolbarProperties;
        }

        public IFilterToolbarOptions AutoSearch(bool autoSearch)
        {
            _filterToolbarProperties.AutoSearch = autoSearch;
            return this;
        }

        public IFilterToolbarOptions BeforeSearch(string beforeSearch)
        {
            _filterToolbarProperties.BeforeSearch = beforeSearch;
            return this;
        }

        public IFilterToolbarOptions AfterSearch(string afterSearch)
        {
            _filterToolbarProperties.AfterSearch = afterSearch;
            return this;
        }

        public IFilterToolbarOptions BeforeClear(string beforeClear)
        {
            _filterToolbarProperties.BeforeClear = beforeClear;
            return this;
        }

        public IFilterToolbarOptions AfterClear(string afterClear)
        {
            _filterToolbarProperties.AfterClear = afterClear;
            return this;
        }

        public IFilterToolbarOptions SearchOnEnter(bool searchOnEnter)
        {
            _filterToolbarProperties.SearchOnEnter = searchOnEnter;
            return this;
        }

        public IFilterToolbarOptions StringResult(bool stringResult)
        {
            _filterToolbarProperties.StringResult = stringResult;
            return this;
        }

        public IFilterToolbarOptions GroupOp(string groupOp)
        {
            _filterToolbarProperties.GroupOp = groupOp;
            return this;
        }

        public IFilterToolbarOptions DefaultSearch(string defaultSearch)
        {
            _filterToolbarProperties.DefaultSearch = defaultSearch;
            return this;
        }

        public void Dispose()
        {
            GC.SuppressFinalize(this);
        }
    }
}